<?php

namespace Modules\Shop\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ArticleRequest extends FormRequest
{
    //验证规则
    public function rules()
    {
        return[
            'title' => 'required',
            'category_id'  => 'required',
            'author'  => 'required',
            'content'  => 'required',
            'thumb'  => 'required',
            'click'  => 'required',
            'iscommend' => 'required',

        ];
    }

    //错误信息处理
    public function messages()
    {
        return [
            'title.required' => '标题不能为空',
            'category_id.required' => '所属分类不能为空',
            'author.required' => '作者不能为',
            'content.required' => '内容不能为空',
            'thumb.required' => '略缩图不能为空',
            'click.required' => '点击次数不能为空',
            'iscommend.required' => '推荐不能为空',
        ];
    }

    //权限验证
    public function authorize()
    {
        return true;
    }
}
